package com.sfac.javaSpringBoot.modules.common.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

//定义枚举
@JsonFormat(shape= JsonFormat.Shape.OBJECT)
public enum ImageType {
//        属性
    PROFILE_BIG("profile-big", 100, 220, 220),
    PROFILE_SMALL("profile-small", 20, 50, 50);


     public String name;
     public int size;
     public int length;
     public int height;

//     定义构造器
    ImageType(String name, int size, int length, int height) {
        this.name = name;
        this.size = size;
        this.length = length;
        this.height = height;
    }
//    静态方法以便获取属性
    public static ImageType getImageTypeByName(String name) {
    for (ImageType imageType : ImageType.values()) {
        if (imageType.name.equals(name)) {
            return imageType;
        }
    }
    return null;
}
}
